home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / russell / russell.lha / examples / callcc_test.r next >
Text File  |  1989-12-29  |  752b  |  32 lines

  1. let
  2.     j == Long$17
  3. in
  4.   trace := True;
  5.   put[
  6.       Callcc[
  7.         func[ cc: func[ val Short] val Void; var Void ] val Short {
  8.             let
  9.                 i == Short$New[];
  10.                 j == Short$New[];
  11.             in
  12.                 put "Got to the body\n";
  13.                 j := 13;
  14.                 put "Forcing garbage collection:\n";
  15.                 do i < 20000 ==>
  16.                     Short$New[]; i += 1;
  17.                 od;
  18.                 put "Finished allocating ";
  19.                 put i;
  20.                 put " objects\n";
  21.                 cc[j];
  22.                 0
  23.             ni
  24.         }
  25.       ]
  26.   ];
  27.   put "\n";
  28.   put "The last line should have contained a 13\n";
  29.   put j;
  30.   put "\nThe last line should have contained a 17\n";
  31. ni
  32.